package mil.af.amc.adpetracker.web.decorators;

import org.displaytag.decorator.TableDecorator;
import mil.af.amc.adpetracker.model.Model;
import mil.af.amc.adpetracker.util.LinkBuilder;

/**
 * Please Fill in this Javadoc
 *
 * @author TSgt Jason Ferguson
 */

public class ModelDecorator extends TableDecorator {

    public int getModelId() {

        Model model = (Model) getCurrentRowObject();
        return model.getId();

    }

    public String getModelName() {

        Model model = (Model) getCurrentRowObject();
        return model.getName();
    }

    public String getModelManufacturer() {

        Model model = (Model) getCurrentRowObject();
        return model.getManufacturer().getName();
    }

    public String getActions() {

        Model model = (Model) getCurrentRowObject();

        LinkBuilder editLink = new LinkBuilder();
        editLink.setName("Edit");
        editLink.setBaseUrl("modelAction.do");
        editLink.addParameter("method", "viewEditModel");
        editLink.addParameter("modelId", model.getId());

        return editLink.getLink(LinkBuilder.LINK_TEXT, true);

    }
}
